package com.xdtech.hotel.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.xdtech.core.model.BaseModel;

/**
 * 
 * @author max.zheng
 * @create 2015-04-04 11:06:39
 * @since 1.0
 * @see 
 */
@Entity
@Table(name="HOTEL_DEVICE")
public class Device extends BaseModel implements Serializable{
	private static final long serialVersionUID = 1L;
	
	public Device() {
		super();
	}
	
	public Device(Long id) {
		super();
		this.id = id;
	}

	public Device(String sn, String ip, String name, String port)
	{
		super();
		this.sn = sn;
		this.ip = ip;
		this.name = name;
		this.port = port;
	}


	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(name="SN")
	private String sn;
	@Column(name="IP")
	private String ip;
	@Column(name="NAME")
	private String name;
	@Column(name="PORT")
	private String port;
	
	@OneToOne(mappedBy="device",fetch=FetchType.EAGER)  
    private Room room;  
	
//	@OneToMany(mappedBy="device")
//	private List<DeviceLink> deviceLinks = new ArrayList<DeviceLink>();

	
	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	public String getSn() {
		return sn;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getIp() {
		return ip;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setPort(String port) {
		this.port = port;
	}
	public String getPort() {
		return port;
	}
	public Room getRoom() {
		return room;
	}
	public void setRoom(Room room) {
		this.room = room;
	}
//	public List<DeviceLink> getDeviceLinks() {
//		return deviceLinks;
//	}
//	public void setDeviceLinks(List<DeviceLink> deviceLinks) {
//		this.deviceLinks = deviceLinks;
//	}
	
	
}
